#ifndef __SYS_CONFIG_H__
#define __SYS_CONFIG_H__

#include "common.h"

typedef map<string, string> SECTION_CONF_MAP;
typedef map<string, SECTION_CONF_MAP> CONFIG_MAP;

class SysConfig
{
public:
	static SysConfig* instance();
	int LoadConfigFile(const string& filename);
	int get_conf_int(const char* section, const char* name, int* value);
	int get_conf_str(const char* section, const char* name,
        			 char* value, int buf_len);
	int write_conf_int(const char* section, const char* name, int value);
	int write_conf_str(const char* section, const char* name, char* value);

private:
	ACE_Configuration_Heap* config_heap_;
	string config_file_;
	CONFIG_MAP config_items_;

	static SysConfig* instance_;
};

#endif
